/**
 * 公共js
 * Created by fangsj on 15/7/3.
 */
var Common = {};
Common.File = {};
Common.cleanForm = cleanForm;
Common.file = function(fileName) {
    if(this.File.isImage(fileName)) {
        return imageFileServerUrl + fileName;
    }
    return fileServerUrl + fileName;
};

Common.File.isImage = function(fileName) {
    var suffix = this.getSuffix(fileName);
    return suffix == "png" || suffix == "jpg" || suffix == "jpeg" || suffix == "gif" || suffix == "bmp";
};

Common.File.isVideo = function(fileName) {
    var suffix = this.getSuffix(fileName);
    return suffix == "video" || suffix == "mp4";
};

Common.File.isRadio = function(fileName) {
    var suffix = this.getSuffix(fileName);
    return suffix == "sound" || suffix == "mp3";
};

Common.File.getSuffix = function(fileName) {
    if(fileName)return fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
    return "-1";

};

function cleanForm(form,clean)
{
    form.reset();
    if(clean) clean();
}
